﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace QLNS.aspFrm
{
    public partial class frmSYLL : System.Web.UI.Page
    {
        public string IDCB { get { return Request.QueryString["id"].ToString(); } }
        protected void Page_Load(object sender, EventArgs e)
        {
            CanBo r_cb = QLNS.Models.CanBoModels.GetChiTietCanBo(Convert.ToInt32(Request.QueryString["id"].ToString()));
            DanToc r_dantoc = QLNS.Models.DanTocModels.GetChiTietDSDanToc((int)r_cb.IDDanToc);
            TonGiao r_tongiao = QLNS.Models.TonGiaoModels.GetChiTietDSTonGiao((int)r_cb.IDTonGiao);
            PhongBan r_phongban = QLNS.Models.PhongBanModels.GetChiTietPhongBan((int)r_cb.IDPhongBan);

            ChucVu r_chucvu = QLNS.Models.PosModels.GetChiTietDSChucVu((int)r_cb.ChucVuHienTai);

            PhuCap r_phucap_chucvu = QLNS.Models.PhuCapModels.GetChiTietDSPhuCap((int)r_chucvu.IDPhuCap);
            string r_heso_phucap_chucvu = r_phucap_chucvu == null ? "0" : r_phucap_chucvu.HeSo.ToString();

            ChuyenMon r_chuyenmon = QLNS.Models.ChuyenMonModels.GetChiTietDSChuyenMon((int)r_cb.TrinhDoChuyenMon);

            //TrinhDoLyLuan r_tdlyluan = QLNS.Models.TrinhDoLyLuanModels.GetChiTietDSTDLyLuan((int)r_cb.TrinhDoLyLuan);
            LyLuan r_lyluan = QLNS.Models.LyLuanModels.GetChiTietDSLyLuan(r_cb.TrinhDoLyLuan == null ? 0 :(int)r_cb.TrinhDoLyLuan);

            //TrinhDoQLNN r_tdqlnn = QLNS.Models.TrinhDoQLNNModels.GetTrinhDoQLNN((int)r_cb.TrinhDoQLNN);
            QLNhaNuoc r_qlnn = QLNS.Models.QLNNModels.GetChiTietDSQLNN(r_cb.TrinhDoQLNN==null?0:(int)r_cb.TrinhDoQLNN);

            //TrinhDoNgoaiNgu r_tdngoaingu = QLNS.Models.TrinhDoNgoaiNguModels.GetChiTietTrinhDoNgoaiNgu((int)r_cb.TrinhDoNgoaiNgu);
            CapNgoaiNgu r_ngoaingu = QLNS.Models.CapNgoaiNguModels.GetChiTietDSCapNgoaiNgu(r_cb.TrinhDoNgoaiNgu==null?0:(int)r_cb.TrinhDoNgoaiNgu);

            //TrinhDoTinHoc r_tdtinhoc = QLNS.Models.TrinhDoTinHocModels.GetChiTietTrinhDoTinHoc((int)r_cb.TrinhDoTinHoc);
            CapTinHoc r_tinhoc = QLNS.Models.CapTinHocModels.GetChiTietDSCapTinHoc(r_cb.TrinhDoTinHoc==null?0:(int)r_cb.TrinhDoTinHoc);

            //thieu LoaiHinhDaoTao và ChucVuKiemNhiem

            //Tính tổng phụ cấp khác phụ cấp chức vụ
            List<ChiTietPhuCap> lstCTPhucap = QLNS.Models.ChiTietPhuCapModels.GetChiTietPhuCapTheoCanBo(r_cb.ID);
            double r_phucapkhac = 0;
            foreach (var _ct in lstCTPhucap)
            {
                if (_ct.IDPhuCap != r_phucap_chucvu.ID)
                {
                    PhuCap _ctphucapkhac = QLNS.Models.PhuCapModels.GetChiTietDSPhuCap(_ct.IDPhuCap==null?0:(int)_ct.IDPhuCap);
                    r_phucapkhac += (double)_ctphucapkhac.HeSo;
                }
            }
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");

            System.Data.DataTable dtTK = MakeTable();

            System.Data.DataRow row;
            row = dtTK.NewRow();

            row["ID"] = r_cb.ID;
            row["TenCoQuan"] = "tên cơ quan";
            row["TenPhongBan"] = r_phongban.TenPhongBan;
            row["SoHieuCBCC"] = r_cb.SoHieuCBCC;
            row["Ho"] = QLNS.Models.CommonModels.LocDau(r_cb.Ho.ToUpper());
            row["Ten"] = QLNS.Models.CommonModels.LocDau(r_cb.Ten.ToUpper());
            row["TenGoiKhac"] = r_cb.TenGoiKhac;
            row["NgaySinh"] = r_cb.NgaySinh.ToString() == "" ? DateTime.Parse("01/1/1900", ci.DateTimeFormat) : r_cb.NgaySinh;
            //if (r_cb.NgaySinh == DateTime.Parse("01/1/1900"))
            //{
            //    row["NgaySinh"] = "";
            //}
            //else
            //{
            //    row["NgaySinh"] = r_cb.NgaySinh;
            //}
            row["GioiTinh"] = r_cb.GioiTinh;
            row["NoiSinh"] = r_cb.NoiSinh;
            row["QueQuan"] = r_cb.QueQuan;
            row["HoKhauThuongTru"] = r_cb.HoKhauThuongTru;
            row["DiaChi"] = r_cb.DiaChi;
            row["NNTuyenDung"] = r_cb.NNTuyenDung;
            // row["NgayTuyenDung"] = r_cb.NgayTuyenDung== null ? DateTime.Parse("01/1/1900"):r_cb.NgayTuyenDung;
            if (r_cb.NgayTuyenDung == DateTime.Parse("01/1/1900"))
            {
                row["NgayTuyenDung"] = "";
            }
            else
            {
                
                string[] words = r_cb.NgayTuyenDung.ToString().Split(' ');
                //s = s.Substring(0, 10);
                
                    row["NgayTuyenDung"] = words[0];
               
               

            }
            row["CoQuanTuyenDung"] = r_cb.CoQuanTuyenDung;
            row["CongViecDuocGiao"] = r_cb.CongViecDuocGiao;
            row["TenNgach"] = r_cb.TenNgachCC;
            row["MaNgachCC"] = r_cb.MaNgachCC;
            row["BacLuong"] = r_cb.BacLuong;
            row["HeSoLuong"] = r_cb.HeSoLuong;
            //row["NgayHuongLuong"] = r_cb.NgayHuongLuong == null ? DateTime.Parse("1/1/1900") : r_cb.NgayHuongLuong;
            if (r_cb.NgayHuongLuong == DateTime.Parse("01/1/1900"))
            {
                row["NgayHuongLuong"] = "";
            }
            else
            {
                string[] s1 = r_cb.NgayHuongLuong.ToString().Split(' ');
                //s1 = s1.Substring(0, 10);
                row["NgayHuongLuong"] = s1[0];
            }
            row["HeSoPhuCap"] = r_heso_phucap_chucvu;
            row["TenPhuCap"] = r_phucapkhac == null?0: r_phucapkhac;
            row["TrinhDoPhoThong"] = r_cb.TrinhDoPhoThong;
            row["TrinhDoChuyenMon"] = r_chuyenmon.Ten;
            row["ChuyenNganh"] = r_cb.ChuyenNganh;
            row["TrinhDoLyLuan"] = r_lyluan == null?"":r_lyluan.Ten;
            row["TrinhDoQLNN"] = r_qlnn == null ? "" : r_qlnn.Ten;
            row["TrinhDoNgoaiNgu"] = r_ngoaingu == null ? "" : r_ngoaingu.Ten;
            row["TenNgoaiNgu"] = r_cb == null ? "" : r_cb.TenNgoaiNgu;
            row["TrinhDoTinHoc"] = r_tinhoc == null ? "" : r_tinhoc.Ten;
            //row["NgayVaoDang"] = r_cb.NgayVaoDang == null ? DateTime.Parse("01/1/1900") : r_cb.NgayVaoDang; 
            if (r_cb.NgayVaoDang == DateTime.Parse("01/1/1900"))
            {
                row["NgayVaoDang"] = "";
            }
            else
            {

                string[] s2 = r_cb.NgayVaoDang.ToString().Split(' ');
                //s2 = s2.Substring(0, 10);
                row["NgayVaoDang"] = s2[0];
            }

            // row["NgayVaoChinhThuc"] = r_cb.NgayVaoChinhThuc == null ? DateTime.Parse("01/1/1900") : r_cb.NgayVaoChinhThuc;
            if (r_cb.NgayVaoChinhThuc == DateTime.Parse("01/1/1900"))
            {

                row["NgayVaoChinhThuc"] = "";
            }
            else
            {
                string[] s3 = r_cb.NgayVaoChinhThuc.ToString().Split(' ');
               // s3 = s3.Substring(0, 10);
                row["NgayVaoChinhThuc"] = s3[0];
            }

            // row["NgayTGTC_CTXH"] = r_cb.NgayTGTC_CTXH == null ? DateTime.Parse("01/1/1900") : r_cb.NgayTGTC_CTXH;
            if (r_cb.NgayTGTC_CTXH == DateTime.Parse("01/1/1900"))
            {
                row["NgayTGTC_CTXH"] = "";
            }
            else
            {
                string[] s4 = r_cb.NgayTGTC_CTXH.ToString().Split(' ');
                //s4 = s4.Substring(0, 10);
                row["NgayTGTC_CTXH"] = s4[0];
            }

            // row["NgayNhapNgu"] = r_cb.NgayNhapNgu == null ? DateTime.Parse("01/1/1900") : r_cb.NgayNhapNgu;
            if (r_cb.NgayNhapNgu == DateTime.Parse("01/1/1900"))
            {
                row["NgayNhapNgu"] = "";
            }
            else
            {
                string[] s5 = r_cb.NgayNhapNgu.ToString().Split(' ');
                //s5 = s5.Substring(0, 10);
                row["NgayNhapNgu"] = s5[0];
            }
            // row["NgayXuatNgu"] = r_cb.NgayXuatNgu== null ? DateTime.Parse("01/1/1900") : r_cb.NgayXuatNgu;
            if (r_cb.NgayXuatNgu == DateTime.Parse("01/1/1900"))
            {
                row["NgayXuatNgu"] = "";
            }
            else
            {
                string[] s6 = r_cb.NgayXuatNgu.ToString().Split(' ');
                //s6 = s6.Substring(0, 10);
                row["NgayXuatNgu"] = s6[0];
            }
            row["QuanHam"] = r_cb.QuanHam;
            row["DanhHieu"] = r_cb.DanhHieu;
            row["SoTruongCongTac"] = r_cb.SoTruongCongTac;
            row["Image"] = r_cb.Image;
            row["TenDanToc"] = r_dantoc.TenDanToc;
            row["TenTonGiao"] = r_tongiao.TenTonGiao;
            row["ThuongBinh"] = r_cb.ThuongBinh;
            row["TiengDanToc"] = r_cb.TiengDanToc;
            row["TgiaHDND"] = r_cb.TgiaHDND;
            row["GiaDinhChinhSach"] = r_cb.GiaDinhChinhSach;
            row["ChieuCao"] = r_cb.ChieuCao;
            row["CanNang"] = r_cb.CanNang;
            row["NhomMau"] = r_cb.NhomMau;
            row["SoCMND"] = r_cb.SoCMND;
            if (r_cb.NgayCap == DateTime.Parse("01/1/1900"))
            {
                row["NgayCap"] = "";
            }
            else
            {
                string[] s7 = r_cb.NgayCap.ToString().Split(' ');
                //s7 = s7.Substring(0, 10);
                row["NgayCap"] = s7[0];
            }
            // row["NgayCap"] = r_cb.NgayCap == null ? DateTime.Parse("01/1/1900") : r_cb.NgayCap;
            row["LichSuBanThan"] = "";
            row["ChucVu"] = r_chucvu.Ten;

            dtTK.Rows.Add(row);

            CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            string strRptPath = Server.MapPath("~/") + "Reports//Report_Soyeulylich.rpt";
            //Loading Report
            rd.Load(strRptPath);

            // Setting report data source
            if (dtTK != null && dtTK.GetType().ToString() != "System.String")
                rd.SetDataSource(dtTK);


            CrystalReportViewer1.ReportSource = rd;
        }

        private System.Data.DataTable MakeTable()
        {
            // Create a new DataTable.
            System.Data.DataTable table = new System.Data.DataTable("Table");

            // Declare variables for DataColumn and DataRow objects.
            System.Data.DataColumn column;

            // Create new DataColumn, set DataType, 
            // ColumnName and add to DataTable.    
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.Int32");
            column.ColumnName = "ID";
            column.Unique = true;
            // Add the Column to the DataColumnCollection.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenCoQuan";
            column.Caption = "Tên cơ quan";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenPhongBan";
            column.Caption = "Tên Phòng ban";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "SoHieuCBCC";
            column.Caption = "Số hiệu CBCC";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Ho";
            column.Caption = "Họ";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Ten";
            column.Caption = "Tên";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenGoiKhac";
            column.Caption = "Tên gọi khác";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.DateTime");
            column.ColumnName = "NgaySinh";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "GioiTinh";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NoiSinh";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "QueQuan";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "HoKhauThuongTru";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "DiaChi";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NNTuyenDung";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayTuyenDung";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "CoQuanTuyenDung";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "CongViecDuocGiao";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenNgach";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "MaNgachCC";
            column.Caption = "Tiến sỹ khoa học";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "BacLuong";
            column.Caption = "Cán sự";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "HeSoLuong";
            column.Caption = "Chuyên viên";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayHuongLuong";
            column.Caption = "NgayHuongLuong";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "HeSoPhuCap";
            column.Caption = "";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenPhuCap";
            column.Caption = "A";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TrinhDoPhoThong";
            column.Caption = "B";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TrinhDoChuyenMon";
            column.Caption = "C";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "ChuyenNganh";
            column.Caption = "D";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TrinhDoLyLuan";
            column.Caption = "A";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TrinhDoQLNN";
            column.Caption = "B";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TrinhDoNgoaiNgu";
            column.Caption = "C";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenNgoaiNgu";
            column.Caption = "Lý luận sơ cấp";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TrinhDoTinHoc";
            column.Caption = "Lý luân trung cấp";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayVaoDang";
            column.Caption = "Ngay vao dang";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayVaoChinhThuc";
            column.Caption = "NgayVaoChinhThuc";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayTGTC_CTXH";
            column.Caption = "NgayTGTC_CTXH";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayNhapNgu";
            column.Caption = "NgayNhapNgu";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayXuatNgu";
            column.Caption = "NgayXuatNgu";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "QuanHam";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "DanhHieu";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "SoTruongCongTac";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Image";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenDanToc";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TenTonGiao";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "ThuongBinh";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TiengDanToc";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "TgiaHDND";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "GiaDinhChinhSach";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "ChieuCao";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "CanNang";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NhomMau";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "SoCMND";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "NgayCap";
            column.Caption = "NgayCap";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "LichSuBanThan";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Create second column.
            column = new System.Data.DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "ChucVu";
            column.Caption = "Phân loại";
            // Add the column to the table.
            table.Columns.Add(column);

            // Make the ID column the primary key column.
            System.Data.DataColumn[] PrimaryKeyColumns = new System.Data.DataColumn[1];
            PrimaryKeyColumns[0] = table.Columns["ID"];
            table.PrimaryKey = PrimaryKeyColumns;
            return table;
        }
    }
}